package com.yf.yfmovieapp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yf.yfmovieapp.mapper.DDUserMapper;
import com.yf.yfmovieapp.pojo.DDUser;
import com.yf.yfmovieapp.service.DDUserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Author Yang_Vincent
 * @Date 2020/8/29 23:54
 */
@Service
public class DDUserServiceImpl extends ServiceImpl<DDUserMapper, DDUser> implements DDUserService {

    @Override
    @Cacheable(cacheNames = "ddUserIno")
    public DDUser getUserInfo(String username) {
        return  this.baseMapper.selectOne(new QueryWrapper<DDUser>().eq("username", username));
    }

    @Override
    @Cacheable(cacheNames = "ddUserIno")
    public DDUser getLoginUserInfo(String username,String password) {
        return  this.baseMapper.selectOne(new QueryWrapper<DDUser>().eq("username", username).eq("password", password));
    }
}
